﻿using System;

namespace SBPweb.Modules.Communication
{

	/// <summary>
	/// Interface for message queue
	/// </summary>
	public interface IMessageQueue
    {

		/// <summary>
		/// Fired when a message put into the queue
		/// </summary>
        event EventHandler<MessageEventArgs> Enqueued;

		/// <summary>
		/// Fired when a message removed from the queue
		/// </summary>
        event EventHandler<MessageEventArgs> Dequeued;

		/// <summary>
		/// Fired when a message peeked
		/// </summary>
        event EventHandler<MessageEventArgs> Peeked;

		/// <summary>
		/// Enqueues a message to the queue
		/// </summary>
		/// <param name="message"></param>
        void Enqueue(IMessage message);

		/// <summary>
		/// Removes and returns the first message from the queue
		/// </summary>
		/// <returns>the message</returns>
        IMessage Dequeue();

		/// <summary>
		/// Returns and keeps the first message of the queue
		/// </summary>
		/// <returns>the message</returns>
        IMessage Peek();

    }

}